package au.com.twosquared.animalfarm.ui.components;

public class Component {

	public float x;
	public float y;

	public float width;
	public float height;

	public int state;

	public boolean dirty;
	public boolean focus;

	public Component(float x, float y, float width, float height) {
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
	}

	public void setState(int state) {
		this.state = state;
		dirty = true;
	}

	// This will be called by some sort of UI manager
	public void drawComponent() {
		dirty = false;
		draw();
	}

	// This will be inherited by children
	public void draw() {

	}

	// This will be inherited by children
	public void update(Object data) {
		// Do whatever with data, this could be input for a textarea or a list
		// or something
	}

	// This will be inherited by children
	public void trigger() {
		// Do stuff when touched
	}

	// This will be inherited by children
	public void release() {
		// Do stuff when released/focus is lost
	}

}
